////////////////////////////////////////////////////////////////
///
/// File: StateChangeHandler.h
/// Author: Lucio Davide Spano
/// Last update: 17 August 2012
/// Description: This file contains the protocol for listening
///              to gestures and sub-gestures completion events
/// To do:
/// ------------------------------------------------------------
/// Copyright (c) 2012 Lucio Davide Spano
///                     (lucio.davide.spano@isti.cnr.it)
///
/// The use and distribution terms for this software are
/// contained in the file named license.txt, which can be found
/// in the root of this distribution.
/// By using this software in any fashion, you are agreeing to
/// be bound by the terms of this license.
///
/// You must not remove this notice, or any other, from this
/// software.
/// ------------------------------------------------------------
////////////////////////////////////////////////////////////////

#import <Foundation/NSObjCRuntime.h>
#import <objc/message.h>
#import "GestureListener.h"
@implementation GestureListener

@synthesize errorSelector, completedSelector, performingSelector, object;

- (id) initWithReceiverSelectors:(id)receiver withCompletedSelector:(SEL)completed{
    return [self initWithReceiverSelectors:receiver withCompletedSelector:completed withErrorSelector:nil withPerformingSelector:nil];
}
- (id) initWithReceiverSelectors:(id)receiver withCompletedSelector:(SEL)completed withErrorSelector:(SEL)error{
    return [self initWithReceiverSelectors:receiver withCompletedSelector:completed withErrorSelector:error withPerformingSelector:nil];
}
- (id) initWithReceiverSelectors:(id)receiver withCompletedSelector:(SEL)completed withErrorSelector:(SEL)error withPerformingSelector:(SEL)performing{
    self = [super init];
    if(self){
        object = receiver;
        completedSelector = completed;
        errorSelector = error;
        performingSelector = performingSelector;
    }
    
    return self;
}

- (void) completed:(TmpExp *)sender :(ExpEventArgs *)args :(Token *)token{
    if(object != nil && completedSelector != nil){
        objc_msgSend(object, completedSelector, sender, args, token);
    }
}

- (void) error:(TmpExp *)sender :(ExpEventArgs *)args :(Token *)token{
    
}

- (void) performing:(TmpExp *)sender :(ExpEventArgs *)args :(Token *)token{
    
}


@end